package Demo1;
import java.util.Scanner;

public class DelStudent {
    public static void main(String[] args) {
        DbUtil db =new DbUtil();
        db.load();
        Scanner input =new Scanner(System.in);
        System.out.println("请输入你要删除学生的学号:");
        int id =input.nextInt();
        System.out.println(db.studentDel(id)?"删除成功":"删除失败");


        /*try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        String url ="jdbc:mysql://localhost:3306/kgc76?useSSL=false";
        Connection conn =null;
        PreparedStatement ps =null;
        try {
            conn= DriverManager.getConnection(url,"root","123456");
            Scanner input =new Scanner(System.in);
            System.out.println("请输入你要删除学生的学号:");
            int id =input.nextInt();
            String sql ="delete from s_student where stuno=?";
            ps= conn.prepareStatement(sql);
            ps.setInt(1,id);
            int num = ps.executeUpdate();
            System.out.printf("删除了%d行。",num);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        finally {
            try {
                ps.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
            try {
                conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }*/
    }
}
